﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MVC.Web.UI.Tabs;

namespace MVC.Web.UI.Tabs
{
    public abstract class NavigationItemTabBuilder : INavigationTabBuilder<NavigationItemTabBuilder> 
    {

        private WebTabCollection<NavigationItem> _items;

        private  NavigationItem _item = null;


        public NavigationItemTabBuilder(WebTabCollection<NavigationItem> collection, string prefix) 
        {
            this.Items = collection;

            Tab tab = new Tab();
            tab.TabId = prefix + Items.Count;

            _item = tab;
            Items.Add(tab);
        }

        protected NavigationItem NavItem
        {
            get { return _item; }
            set { _item = value; }
        }

        protected WebTabCollection<NavigationItem> Items
        {
            get { return _items; }
            set { _items = value; } 
        }

        public abstract INavigationTabBuilder<NavigationItemTabBuilder> Name(string name);

        public abstract INavigationTabBuilder<NavigationItemTabBuilder> Content(Func<NavigationItemTabBuilder, System.Web.WebPages.HelperResult> content);

        public abstract INavigationTabBuilder<NavigationItemTabBuilder> Url(string url);

        public abstract INavigationTabBuilder<NavigationItemTabBuilder> AjaxLoad(bool ajaxLoad);

        public abstract INavigationItem<NavigationItem> GetItem();
    }
}
